// @ts-nocheck
// The module 'vscode' contains the VS Code extensibility API
// Import the module and reference it with the alias vscode in your code below
const vscode = require("vscode");
const TreeViewProvider = require("./config/TreeViewProvider");
const { createWebView } = require("./config/WebViewProvider");

// This method is called when your extension is activated
// Your extension is activated the very first time the command is executed

/**
 * @param {vscode.ExtensionContext} context
 */
function activate(context) {
  // const customTreeViewProvider = new TreeViewProvider(context);
  // vscode.window.registerWebviewViewProvider("aplc.view1", TreeViewProvider.createOrShow(context));

  const treeDataProvider = new TreeViewProvider();
  vscode.window.registerTreeDataProvider("aplc.view1", treeDataProvider);

  let disposable = vscode.commands.registerCommand("itemClick", function () {
    vscode.window.showInformationMessage("Hello World from antd-pro-low-code!");
  });
  context.subscriptions.push(disposable);

  // 注册树形视图节点按钮的命令处理函数
  context.subscriptions.push(
    // aplc.start 命令集合 package.json command
    vscode.commands.registerCommand("aplc.start", (label) => {
      const webView = createWebView(vscode.ViewColumn.Active, label);
      context.subscriptions.push(webView);
    })
  );
}

// This method is called when your extension is deactivated
function deactivate() {}

module.exports = {
  activate,
  deactivate,
};
